﻿@using Microsoft.AspNetCore.Mvc.Razor
@model KnowledgebaseArticleModel

@Html.ValidationSummary(true)
<input asp-for="Id" type="hidden"/>

@{
    Func<int, HelperResult>
        template = @<div class="form-body">
            <div class="form-group">
                <admin-label asp-for="@Model.Locales[item].Name"/>
                <div class="col-md-9 col-sm-9">
                    <admin-input asp-for="@Model.Locales[item].Name"/>
                    <span asp-validation-for="@Model.Locales[item].Name"></span>
                </div>
            </div>
            <div class="form-group">
                <admin-label asp-for="@Model.Locales[item].Content"/>
                <div class="col-md-9 col-sm-9">
                    <admin-input asp-for="@Model.Locales[item].Content" asp-template="Editor"/>
                    <span asp-validation-for="@Model.Locales[item].Content"></span>
                </div>

            </div>
            <input type="hidden" asp-for="@Model.Locales[item].LanguageId"/>
        </div>;
}
<div class="form-horizontal">
    <localized-editor localized-template="@template" name="knowledbasearticle-info-localized" language-ids="@Model.Locales.Select(c => c.LanguageId).ToList()">
        <div class="form-body">
            <div class="form-group">
                <admin-label asp-for="Name"/>
                <div class="col-md-9 col-sm-9">
                    <admin-input asp-for="Name"/>
                    <span asp-validation-for="Name"></span>
                </div>
            </div>
            <div class="form-group">
                <admin-label asp-for="Content"/>
                <div class="col-md-9 col-sm-9">
                    <admin-input asp-for="Content" asp-template="Editor"/>
                    <span asp-validation-for="Content"></span>
                </div>
            </div>
        </div>
    </localized-editor>

    <div class="form-body">
        <div class="form-group">
            <admin-label asp-for="ParentCategoryId"/>
            <div class="col-md-9 col-sm-9">
                <admin-select asp-for="ParentCategoryId" asp-items="Model.Categories"/>
                <span asp-validation-for="ParentCategoryId"></span>
            </div>
        </div>
        <div class="form-group">
            <admin-label asp-for="DisplayOrder"/>
            <div class="col-md-9 col-sm-9">
                <admin-input asp-for="DisplayOrder"/>
                <span asp-validation-for="DisplayOrder"></span>
            </div>
        </div>
        <div class="form-group">
            <admin-label asp-for="AllowComments"/>
            <div class="col-md-9 col-sm-9">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="AllowComments"/>
                    <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="AllowComments"></span>
            </div>
        </div>
        <div class="form-group">
            <admin-label asp-for="Published"/>
            <div class="col-md-9 col-sm-9">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="Published"/>
                    <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="Published"></span>
            </div>
        </div>
        <div class="form-group">
            <admin-label asp-for="ShowOnHomepage"/>
            <div class="col-md-9 col-sm-9">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="ShowOnHomepage"/>
                    <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="ShowOnHomepage"></span>
            </div>
        </div>
        <div class="form-group">
            <admin-label asp-for="CustomerGroups"/>
            <div class="col-md-9 col-sm-9">
                <admin-input asp-for="CustomerGroups"/>
                <span asp-validation-for="CustomerGroups"></span>
            </div>
        </div>
        <div class="form-group">
            <admin-label asp-for="Stores"/>
            <div class="col-md-9 col-sm-9">
                <admin-input asp-for="Stores"/>
                <span asp-validation-for="Stores"></span>
            </div>
        </div>
    </div>
</div>